#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<math.h>
#define PI 3.1415926
int main()
{
	double a=300,b=100;  //椭圆轨迹
	double x1=250,y1=-pow((double)(1-(x1-300)*(x1-300)/(a*a)),0.5)*b+300;  //椭圆初始位置（仅改变x\\
	坐标即可）
	double x2=0,y2=-pow((double)(1-(x2-300)*(x2-300)/(a*a)),0.5)*b+300; 
	double x3=350,y3=pow((double)(1-(x3-300)*(x3-300)/(a*a)),0.5)*b+300; 
	double x4=600,y4=pow((double)(1-(x4-300)*(x4-300)/(a*a)),0.5)*b+300;

	double x21=250,y21=-pow((double)(1-(x21-300)*(x21-300)/(a*a)),0.5)*b+300;
	double x22=250,y22=-pow((double)(1-(x22-300)*(x22-300)/(a*a)),0.5)*b+300;
	double x23=250,y23=-pow((double)(1-(x23-300)*(x23-300)/(a*a)),0.5)*b+300;
	double x24=250,y24=-pow((double)(1-(x24-300)*(x24-300)/(a*a)),0.5)*b+300;


	double vx1=30;    //运动速度
	double vx2=30;    //运动速度
	double vx3=-30;    //运动速度
	double vx4=-30;    //运动速度
	double vx21=30;
	double vx22=30;
	double vx23=-30;
	double vx24=-30;



	double s1=1;    //表达式改变判定条件
	double s2=1;    //表达式改变判定条件
	double s3=1;    //表达式改变判定条件
	double s4=1;    //表达式改变判定条件

	double s23=1;
	double s22=1;
	double s21=1;
	double s24=1;


	double o5=PI/3;   //倾斜角度（应该是）
	double o6=PI/3; 
	double o7=PI/3;
	double o8=PI/3;
	double o9=PI*2/3;
	double o10=PI*2/3;
	double o11=PI*2/3;
	double o12=PI*2/3;

	double o13=PI/3;
	double o14=PI/3;
	double o15=PI/3;
	double o16=PI/3;

	double o17=PI*2/3;
	double o18=PI*2/3;
	double o19=PI*2/3;
	double o20=PI*2/3;



	double A5=300,B5=100;   //椭圆形状
	double A6=300,B6=100; 
	double A7=300,B7=100; 
	double A8=300,B8=100; 
	double A9=300,B9=200;
	double A10=300,B10=200;
	double A11=300,B11=200;
	double A12=300,B12=200;

	double A13=300,B13=100;
	double A14=300,B14=100;
	double A15=300,B15=100;
	double A16=300,B16=100;

	double A17=300,B17=200;
	double A18=300,B18=200;
	double A19=300,B19=200;
	double A20=300,B20=200;


    double a5=cos(o5)*cos(o5)/(A5*A5)+sin(o5)*sin(o5)/(B5*B5),b5=sin(o5)*sin(o5)/(A5*A5)+cos(o5)*cos(o5)/(B5*B5),c5=cos(o5)*sin(o5)/(A5*A5)-cos(o5)*sin(o5)/(B5*B5);  //不要动！！！
	double a6=cos(o6)*cos(o6)/(A6*A6)+sin(o6)*sin(o6)/(B6*B6),b6=sin(o6)*sin(o6)/(A6*A6)+cos(o6)*cos(o6)/(B6*B6),c6=cos(o6)*sin(o6)/(A6*A6)-cos(o6)*sin(o6)/(B6*B6);
	double a7=cos(o7)*cos(o7)/(A7*A7)+sin(o7)*sin(o7)/(B7*B7),b7=sin(o7)*sin(o7)/(A7*A7)+cos(o7)*cos(o7)/(B7*B7),c7=cos(o7)*sin(o7)/(A7*A7)-cos(o7)*sin(o7)/(B7*B7);
	double a8=cos(o8)*cos(o8)/(A8*A8)+sin(o8)*sin(o8)/(B8*B8),b8=sin(o8)*sin(o8)/(A8*A8)+cos(o8)*cos(o8)/(B8*B8),c8=cos(o8)*sin(o8)/(A8*A8)-cos(o8)*sin(o8)/(B8*B8);
	double a9=cos(o9)*cos(o9)/(A9*A9)+sin(o9)*sin(o9)/(B9*B9),b9=sin(o9)*sin(o9)/(A9*A9)+cos(o9)*cos(o9)/(B9*B9),c9=cos(o9)*sin(o9)/(A9*A9)-cos(o9)*sin(o9)/(B9*B9);
	double a10=cos(o10)*cos(o10)/(A10*A10)+sin(o10)*sin(o10)/(B10*B10),b10=sin(o10)*sin(o10)/(A10*A10)+cos(o10)*cos(o10)/(B10*B10),c10=cos(o10)*sin(o10)/(A10*A10)-cos(o10)*sin(o10)/(B10*B10);
	double a11=cos(o11)*cos(o11)/(A11*A11)+sin(o11)*sin(o11)/(B11*B11),b11=sin(o11)*sin(o11)/(A11*A11)+cos(o11)*cos(o11)/(B11*B11),c11=cos(o11)*sin(o11)/(A11*A11)-cos(o11)*sin(o11)/(B11*B11);
	double a12=cos(o12)*cos(o12)/(A12*A12)+sin(o12)*sin(o12)/(B12*B12),b12=sin(o12)*sin(o12)/(A12*A12)+cos(o12)*cos(o12)/(B12*B12),c12=cos(o12)*sin(o12)/(A12*A12)-cos(o12)*sin(o12)/(B12*B12);

	double a13=cos(o13)*cos(o13)/(A13*A13)+sin(o13)*sin(o13)/(B13*B13),b13=sin(o13)*sin(o13)/(A13*A13)+cos(o13)*cos(o13)/(B13*B13),c13=cos(o13)*sin(o13)/(A13*A13)-cos(o13)*sin(o13)/(B13*B13);
	double a14=cos(o14)*cos(o14)/(A14*A14)+sin(o14)*sin(o14)/(B14*B14),b14=sin(o14)*sin(o14)/(A14*A14)+cos(o14)*cos(o14)/(B14*B14),c14=cos(o14)*sin(o14)/(A14*A14)-cos(o14)*sin(o14)/(B14*B14);
	double a15=cos(o15)*cos(o15)/(A15*A15)+sin(o15)*sin(o15)/(B15*B15),b15=sin(o15)*sin(o15)/(A15*A15)+cos(o15)*cos(o15)/(B15*B15),c15=cos(o15)*sin(o15)/(A15*A15)-cos(o15)*sin(o15)/(B15*B15);
	double a16=cos(o16)*cos(o16)/(A16*A16)+sin(o16)*sin(o16)/(B16*B16),b16=sin(o16)*sin(o16)/(A16*A16)+cos(o16)*cos(o16)/(B16*B16),c16=cos(o16)*sin(o16)/(A16*A16)-cos(o16)*sin(o16)/(B16*B16);

	double a17=cos(o17)*cos(o17)/(A17*A17)+sin(o17)*sin(o17)/(B17*B17),b17=sin(o17)*sin(o17)/(A17*A17)+cos(o17)*cos(o17)/(B17*B17),c17=cos(o17)*sin(o17)/(A17*A17)-cos(o17)*sin(o17)/(B17*B17);
	double a18=cos(o18)*cos(o18)/(A18*A18)+sin(o18)*sin(o18)/(B18*B18),b18=sin(o18)*sin(o18)/(A18*A18)+cos(o18)*cos(o18)/(B18*B18),c18=cos(o18)*sin(o18)/(A18*A18)-cos(o18)*sin(o18)/(B18*B18);
	double a19=cos(o19)*cos(o19)/(A19*A19)+sin(o19)*sin(o19)/(B19*B19),b19=sin(o19)*sin(o19)/(A19*A19)+cos(o19)*cos(o19)/(B19*B19),c19=cos(o19)*sin(o19)/(A19*A19)-cos(o19)*sin(o19)/(B19*B19);
	double a20=cos(o20)*cos(o20)/(A20*A20)+sin(o20)*sin(o20)/(B20*B20),b20=sin(o20)*sin(o20)/(A20*A20)+cos(o20)*cos(o20)/(B20*B20),c20=cos(o20)*sin(o20)/(A20*A20)-cos(o20)*sin(o20)/(B20*B20);


	double x5=300-sqrt((double)b5/(b5*a5-c5*c5)),y5=(-c5*(x5-300)+sqrt((double)c5*c5*(x5-300)*(x5-300)-b5*(a5*(x5-300)*(x5-300)-1)))/b5+300;  //倾斜椭圆初始位置（别忘了下面还有）
	double x6=500-sqrt((double)b6/(b6*a6-c6*c6)),y6=(-c6*(x6-300)+sqrt((double)c6*c6*(x6-300)*(x6-300)-b6*(a6*(x6-300)*(x6-300)-1)))/b6+300;
	double x7=400-sqrt((double)b7/(b7*a7-c7*c7)),y7=(-c7*(x7-300)-sqrt((double)c7*c7*(x7-300)*(x7-300)-b7*(a7*(x7-300)*(x7-300)-1)))/b7+300;
	double x8=600-sqrt((double)b8/(b8*a8-c8*c8)),y8=(-c8*(x8-300)-sqrt((double)c8*c8*(x8-300)*(x8-300)-b8*(a8*(x8-300)*(x8-300)-1)))/b8+300;
	double x9=300-sqrt((double)b9/(b9*a9-c9*c9)),y9=(-c9*(x9-300)+sqrt((double)c9*c9*(x9-300)*(x9-300)-b9*(a9*(x9-300)*(x9-300)-1)))/b9+300;
	double x10=500-sqrt((double)b10/(b10*a10-c10*c10)),y10=(-c10*(x10-300)+sqrt((double)c10*c10*(x10-300)*(x10-300)-b10*(a10*(x10-300)*(x10-300)-1)))/b10+300;
	double x11=400-sqrt((double)b11/(b11*a11-c11*c11)),y11=(-c11*(x11-300)-sqrt((double)c11*c11*(x11-300)*(x11-300)-b11*(a11*(x11-300)*(x11-300)-1)))/b11+300;
	double x12=600-sqrt((double)b12/(b12*a12-c12*c12)),y12=(-c12*(x12-300)-sqrt((double)c12*c12*(x12-300)*(x12-300)-b12*(a12*(x12-300)*(x12-300)-1)))/b12+300;

	double x13=350-sqrt((double)b13/(b13*a13-c13*c13)),y13=(-c13*(x13-300)+sqrt((double)c13*c13*(x13-300)*(x13-300)-b13*(a13*(x13-300)*(x13-300)-1)))/b13+300;
	double x14=450-sqrt((double)b14/(b14*a14-c14*c14)),y14=(-c14*(x14-300)+sqrt((double)c14*c14*(x14-300)*(x14-300)-b14*(a14*(x14-300)*(x14-300)-1)))/b14+300;
	double x15=550-sqrt((double)b15/(b15*a15-c15*c15)),y15=(-c15*(x15-300)-sqrt((double)c15*c15*(x15-300)*(x15-300)-b15*(a15*(x15-300)*(x15-300)-1)))/b15+300;
	double x16=200-sqrt((double)b16/(b16*a16-c16*c16)),y16=(-c16*(x16-300)-sqrt((double)c16*c16*(x16-300)*(x16-300)-b16*(a16*(x16-300)*(x16-300)-1)))/b16+300;

	double x17=300-sqrt((double)b17/(b17*a17-c17*c17)),y17=(-c17*(x17-300)+sqrt((double)c17*c17*(x17-300)*(x17-300)-b17*(a17*(x17-300)*(x17-300)-1)))/b17+300;
	double x18=300-sqrt((double)b18/(b18*a18-c18*c18)),y18=(-c18*(x18-300)+sqrt((double)c18*c18*(x18-300)*(x18-300)-b18*(a18*(x18-300)*(x18-300)-1)))/b18+300;
	double x19=300-sqrt((double)b19/(b19*a19-c19*c19)),y19=(-c19*(x19-300)-sqrt((double)c19*c19*(x19-300)*(x19-300)-b19*(a19*(x19-300)*(x19-300)-1)))/b19+300;
	double x20=300-sqrt((double)b20/(b20*a20-c20*c20)),y20=(-c20*(x20-300)-sqrt((double)c20*c20*(x20-300)*(x20-300)-b20*(a20*(x20-300)*(x20-300)-1)))/b20+300;

	double vx5=20;    //运动速度
	double vx6=20;
	double vx7=-20;
	double vx8=-20;
	double vx9=20;
	double vx10=20;
	double vx11=-20;
	double vx12=-20;

	double vx13=20;
	double vx14=20;
	double vx15=-20;
	double vx16=-20;

	double vx17=20;
	double vx18=20;
	double vx19=-20;
	double vx20=-20;

	double s5=1;    //表达式改变判定条件
	double s6=1;
	double s7=1;
	double s8=1;
	double s9=1;
	double s10=1;
	double s11=1;
	double s12=1;

	double s13=1;
	double s14=1;
	double s15=1;
	double s16=1;

	double s17=1;
	double s18=1;
	double s19=1;
	double s20=1;

	double w5=-1;
	double w6=-1;
	double w7=-1;
	double w8=-1;
	double w9=-1;
	double w10=-1;
	double w11=-1;
	double w12=-1;

	double w13=-1;
	double w14=-1;
	double w15=-1;
	double w16=-1;

	double w17=-1;
	double w18=-1;
	double w19=-1;
	double w20=-1;

	double color1=rand()%255,color2=rand()%255,color3=rand()%255;
	double p1=0.1,p2=0.1,p3=0.1;

	initgraph(600,600);
	BeginBatchDraw();  //批量绘制（防卡顿）（可忽略）
	while(1)
	{
		
		setbkcolor(RGB(0,0,0));
		cleardevice();
		
		x1=x1+vx1;    //自变量动态化
		if(s1==1)     //选择执行
		{
			y1=-pow((double)(1-(x1-300)*(x1-300)/(a*a)),0.5)*b+300;
		}
		else if(s1==-1)  
		{
			y1=pow((double)(1-(x1-300)*(x1-300)/(a*a)),0.5)*b+300;
			
		}
		if(x1>600 || x1<0)  //进行执行命令的改变以及自变量变化方向的改变
		{
			vx1=-vx1;
			s1=-s1;
		}

		fillcircle(x1,y1,5);    //描绘图形



		x2=x2+vx2;    //自变量动态化
		if(s2==1)     //选择执行
		{
			y2=-pow((double)(1-(x2-300)*(x2-300)/(a*a)),0.5)*b+300;
		}
		else if(s2==-1)  
		{
			y2=pow((double)(1-(x2-300)*(x2-300)/(a*a)),0.5)*b+300;
			
		}
		if(x2>600 || x2<0)  //进行执行命令的改变以及自变量变化方向的改变
		{
			vx2=-vx2;
			s2=-s2;
		}

		fillcircle(x2,y2,5);    //描绘图形




		x3=x3+vx3;    //自变量动态化
		if(s3==1)     //选择执行
		{
			y3=pow((double)(1-(x3-300)*(x3-300)/(a*a)),0.5)*b+300;
		}
		else if(s3==-1)  
		{
			y3=-pow((double)(1-(x3-300)*(x3-300)/(a*a)),0.5)*b+300;
			
		}
		if(x3>600 || x3<0)  //进行执行命令的改变以及自变量变化方向的改变
		{
			vx3=-vx3;
			s3=-s3;
		}

		fillcircle(x3,y3,5);    //描绘图形



		x4=x4+vx4;    //自变量动态化
		if(s4==1)     //选择执行
		{
			y4=pow((double)(1-(x4-300)*(x4-300)/(a*a)),0.5)*b+300;
		}
		else if(s4==-1)  
		{
			y4=-pow((double)(1-(x4-300)*(x4-300)/(a*a)),0.5)*b+300;
			
		}
		if(x4>600 || x4<0)  //进行执行命令的改变以及自变量变化方向的改变
		{
			vx4=-vx4;
			s4=-s4;
		}

		fillcircle(x4,y4,5);    //描绘图形

		x21=x21+vx21;    //自Á?变À?量¢?动¡¥态¬?化¡¥
		if(s21==1)     //选?择?执¡ä行D
		{
			y21=-pow((double)(1-(x21-300)*(x21-300)/(a*a)),0.5)*b+300;
		}
		else if(s21==-1)  
		{
			y21=pow((double)(1-(x21-300)*(x21-300)/(a*a)),0.5)*b+300;
			
		}
		if(x21>600 || x21<0)  //进?行D执¡ä行D命¨¹令¢?的Ì?改?变À?以°?及¡ã自Á?变À?量¢?变À?化¡¥方¤?向¨°的Ì?改?变À?
		{
			vx21=-vx21;
			s21=-s21;
		}

		fillcircle(x21,y21,5);    //描¨¨绘?图ª?形?

		x22=x22+vx22;    //自Á?变À?量¢?动¡¥态¬?化¡¥
		if(s22==1)     //选?择?执¡ä行D
		{
			y22=-pow((double)(1-(x22-300)*(x22-300)/(a*a)),0.5)*b+300;
		}
		else if(s22==-1)  
		{
			y22=pow((double)(1-(x22-300)*(x22-300)/(a*a)),0.5)*b+300;
			
		}
		if(x22>600 || x22<0)  //进?行D执¡ä行D命¨¹令¢?的Ì?改?变À?以°?及¡ã自Á?变À?量¢?变À?化¡¥方¤?向¨°的Ì?改?变À?
		{
			vx22=-vx22;
			s22=-s22;
		}

		fillcircle(x22,y22,5);    //描¨¨绘?图ª?形?

		x23=x23+vx23;    //自Á?变À?量¢?动¡¥态¬?化¡¥
		if(s23==1)     //选?择?执¡ä行D
		{
			y23=-pow((double)(1-(x23-300)*(x23-300)/(a*a)),0.5)*b+300;
		}
		else if(s23==-1)  
		{
			y23=pow((double)(1-(x23-300)*(x23-300)/(a*a)),0.5)*b+300;
			
		}
		if(x23>600 || x23<0)  //进?行D执¡ä行D命¨¹令¢?的Ì?改?变À?以°?及¡ã自Á?变À?量¢?变À?化¡¥方¤?向¨°的Ì?改?变À?
		{
			vx23=-vx23;
			s23=-s23;
		}

		fillcircle(x23,y23,5);    //描¨¨绘?图ª?形?

		x24=x24+vx24;    //自Á?变À?量¢?动¡¥态¬?化¡¥
		if(s24==1)     //选?择?执¡ä行D
		{
			y24=-pow((double)(1-(x24-300)*(x24-300)/(a*a)),0.5)*b+300;
		}
		else if(s24==-1)  
		{
			y24=pow((double)(1-(x24-300)*(x24-300)/(a*a)),0.5)*b+300;
			
		}
		if(x24>600 || x24<0)  //进?行D执¡ä行D命¨¹令¢?的Ì?改?变À?以°?及¡ã自Á?变À?量¢?变À?化¡¥方¤?向¨°的Ì?改?变À?
		{
			vx24=-vx24;
			s24=-s24;
		}

		fillcircle(x24,y24,5);    //描¨¨绘?图ª?形?



		B5=B5+w5;
		if(B5==0)
		{
			w5=-w5;
		}
		if(B5==100)
		{
			w5=-w5;
		}
		a5=cos(o5)*cos(o5)/(A5*A5)+sin(o5)*sin(o5)/(B5*B5),b5=sin(o5)*sin(o5)/(A5*A5)+cos(o5)*cos(o5)/(B5*B5),c5=cos(o5)*sin(o5)/(A5*A5)-cos(o5)*sin(o5)/(B5*B5);
		x5=x5+vx5;    //自变量动态化
		fillcircle(x5,y5,5);    //描绘图形
		if(s5==1)
		{
			y5=(-c5*(x5-300)+pow((double)c5*c5*(x5-300)*(x5-300)-b5*(a5*(x5-300)*(x5-300)-1),0.5))/b5+300;
		}
		if(s5==-1)
		{
			y5=(-c5*(x5-300)-pow((double)c5*c5*(x5-300)*(x5-300)-b5*(a5*(x5-300)*(x5-300)-1),0.5))/b5+300;
		}
		if(x5>300+sqrt((double)b5/(b5*a5-c5*c5)) || x5<300-sqrt((double)b5/(b5*a5-c5*c5)))
		{
			vx5=-vx5;
			s5=-s5;
		}

		x7=x7+vx7;    //自Á?变À?量¢?动¡¥态¬?化¡¥
		if(s7==1)     //选?择?执¡ä行D
		{
			y7=-pow((double)(1-(x7-300)*(x7-300)/(a*a)),0.5)*b+300;
		}
		else if(s7==-1)  
		{
			y7=pow((double)(1-(x7-300)*(x7-300)/(a*a)),0.5)*b+300;
			
		}
		if(x7>600 || x7<0)  //进?行D执¡ä行D命¨¹令¢?的Ì?改?变À?以°?及¡ã自Á?变À?量¢?变À?化¡¥方¤?向¨°的Ì?改?变À?
		{
			vx7=-vx7;
			s7=-s7;
		}

		fillcircle(x7,y7,5);    //描¨¨绘?图ª?形?

		

		B6=B6+w6;
		if(B6==0)
		{
			w6=-w6;
		}
		if(B6==100)
		{
			w6=-w6;
		}
		a6=cos(o6)*cos(o6)/(A6*A6)+sin(o6)*sin(o6)/(B6*B6),b6=sin(o6)*sin(o6)/(A6*A6)+cos(o6)*cos(o6)/(B6*B6),c6=cos(o6)*sin(o6)/(A6*A6)-cos(o6)*sin(o6)/(B6*B6);
		x6=x6+vx6;    //自变量动态化
		fillcircle(x6,y6,5);    //描绘图形
		if(s6==1)
		{
			y6=(-c6*(x6-300)+pow((double)c6*c6*(x6-300)*(x6-300)-b6*(a6*(x6-300)*(x6-300)-1),0.5))/b6+300;
		}
		if(s6==-1)
		{
			y6=(-c6*(x6-300)-pow((double)c6*c6*(x6-300)*(x6-300)-b6*(a6*(x6-300)*(x6-300)-1),0.5))/b6+300;
		}
		if(x6>300+sqrt((double)b6/(b6*a6-c6*c6)) || x6<300-sqrt((double)b6/(b6*a6-c6*c6)))
		{
			vx6=-vx6;
			s6=-s6;
		}



		B7=B7+w7;
		if(B7==0)
		{
			w7=-w7;
		}
		if(B7==100)
		{
			w7=-w7;
		}
		a7=cos(o7)*cos(o7)/(A7*A7)+sin(o7)*sin(o7)/(B7*B7),b7=sin(o7)*sin(o7)/(A7*A7)+cos(o7)*cos(o7)/(B7*B7),c7=cos(o7)*sin(o7)/(A7*A7)-cos(o7)*sin(o7)/(B7*B7);
		x7=x7+vx7;    //自变量动态化
		fillcircle(x7,y7,5);    //描绘图形
		if(s7==1)
		{
			y7=(-c7*(x7-300)+pow((double)c7*c7*(x7-300)*(x7-300)-b7*(a7*(x7-300)*(x7-300)-1),0.5))/b7+300;
		}
		if(s7==-1)
		{
			y7=(-c7*(x7-300)-pow((double)c7*c7*(x7-300)*(x7-300)-b7*(a7*(x7-300)*(x7-300)-1),0.5))/b7+300;
		}
		if(x7>300+sqrt((double)b7/(b7*a7-c7*c7)) || x7<300-sqrt((double)b7/(b7*a7-c7*c7)))
		{
			vx7=-vx7;
			s7=-s7;
		}



		B8=B8+w8;
		if(B8==0)
		{
			w8=-w8;
		}
		if(B8==100)
		{
			w8=-w8;
		}
		a8=cos(o8)*cos(o8)/(A8*A8)+sin(o8)*sin(o8)/(B8*B8),b8=sin(o8)*sin(o8)/(A8*A8)+cos(o8)*cos(o8)/(B8*B8),c8=cos(o8)*sin(o8)/(A8*A8)-cos(o8)*sin(o8)/(B8*B8);
		x8=x8+vx8;    //自变量动态化
		fillcircle(x8,y8,5);    //描绘图形
		if(s8==1)
		{
			y8=(-c8*(x8-300)+pow((double)c8*c8*(x8-300)*(x8-300)-b8*(a8*(x8-300)*(x8-300)-1),0.5))/b8+300;
		}
		if(s8==-1)
		{
			y8=(-c8*(x8-300)-pow((double)c8*c8*(x8-300)*(x8-300)-b8*(a8*(x8-300)*(x8-300)-1),0.5))/b8+300;
		}
		if(x8>300+sqrt((double)b8/(b8*a8-c8*c8)) || x8<300-sqrt((double)b8/(b8*a8-c8*c8)))
		{
			vx8=-vx8;
			s8=-s8;
		}

		

		B9=B9+w9;
		if(B9==0)
		{
			w9=-w9;
		}
		if(B9==200)
		{
			w9=-w9;
		}
		a9=cos(o9)*cos(o9)/(A9*A9)+sin(o9)*sin(o9)/(B9*B9),b9=sin(o9)*sin(o9)/(A9*A9)+cos(o9)*cos(o9)/(B9*B9),c9=cos(o9)*sin(o9)/(A9*A9)-cos(o9)*sin(o9)/(B9*B9);
		x9=x9+vx9;    //自变量动态化
		fillcircle(x9,y9,5);    //描绘图形
		if(s9==1)
		{
			y9=(-c9*(x9-300)+pow((double)c9*c9*(x9-300)*(x9-300)-b9*(a9*(x9-300)*(x9-300)-1),0.5))/b9+300;
		}
		if(s9==-1)
		{
			y9=(-c9*(x9-300)-pow((double)c9*c9*(x9-300)*(x9-300)-b9*(a9*(x9-300)*(x9-300)-1),0.5))/b9+300;
		}
		if(x9>300+sqrt((double)b9/(b9*a9-c9*c9)) || x9<300-sqrt((double)b9/(b9*a9-c9*c9)))
		{
			vx9=-vx9;
			s9=-s9;
		}



		B10=B10+w10;
		if(B10==0)
		{
			w10=-w10;
		}
		if(B10==200)
		{
			w10=-w10;
		}
		a10=cos(o10)*cos(o10)/(A10*A10)+sin(o10)*sin(o10)/(B10*B10),b10=sin(o10)*sin(o10)/(A10*A10)+cos(o10)*cos(o10)/(B10*B10),c10=cos(o10)*sin(o10)/(A10*A10)-cos(o10)*sin(o10)/(B10*B10);
		x10=x10+vx10;    //自变量动态化
		fillcircle(x10,y10,5);    //描绘图形
		if(s10==1)
		{
			y10=(-c10*(x10-300)+pow((double)c10*c10*(x10-300)*(x10-300)-b10*(a10*(x10-300)*(x10-300)-1),0.5))/b10+300;
		}
		if(s10==-1)
		{
			y10=(-c10*(x10-300)-pow((double)c10*c10*(x10-300)*(x10-300)-b10*(a10*(x10-300)*(x10-300)-1),0.5))/b10+300;
		}
		if(x10>300+sqrt((double)b10/(b10*a10-c10*c10)) || x10<300-sqrt((double)b10/(b10*a10-c10*c10)))
		{
			vx10=-vx10;
			s10=-s10;
		}


		B11=B11+w11;
		if(B11==0)
		{
			w11=-w11;
		}
		if(B11==200)
		{
			w11=-w11;
		}
		a11=cos(o11)*cos(o11)/(A11*A11)+sin(o11)*sin(o11)/(B11*B11),b11=sin(o11)*sin(o11)/(A11*A11)+cos(o11)*cos(o11)/(B11*B11),c11=cos(o11)*sin(o11)/(A11*A11)-cos(o11)*sin(o11)/(B11*B11);
		x11=x11+vx11;    //自变量动态化
		fillcircle(x11,y11,5);    //描绘图形
		if(s11==1)
		{
			y11=(-c11*(x11-300)-pow((double)c11*c11*(x11-300)*(x11-300)-b11*(a11*(x11-300)*(x11-300)-1),0.5))/b11+300;
		}
		if(s11==-1)
		{
			y11=(-c11*(x11-300)+pow((double)c11*c11*(x11-300)*(x11-300)-b11*(a11*(x11-300)*(x11-300)-1),0.5))/b11+300;
		}
		if(x11>300+sqrt((double)b11/(b11*a11-c11*c11)) || x11<300-sqrt((double)b11/(b11*a11-c11*c11)))
		{
			vx11=-vx11;
			s11=-s11;
		}



		B12=B12+w12;
		if(B12==0)
		{
			w12=-w12;
		}
		if(B12==200)
		{
			w12=-w12;
		}
		a12=cos(o12)*cos(o12)/(A12*A12)+sin(o12)*sin(o12)/(B12*B12),b12=sin(o12)*sin(o12)/(A12*A12)+cos(o12)*cos(o12)/(B12*B12),c12=cos(o12)*sin(o12)/(A12*A12)-cos(o12)*sin(o12)/(B12*B12);
		x12=x12+vx12;    //自变量动态化
		fillcircle(x12,y12,5);    //描绘图形
		if(s12==1)
		{
			y12=(-c12*(x12-300)-pow((double)c12*c12*(x12-300)*(x12-300)-b12*(a12*(x12-300)*(x12-300)-1),0.5))/b12+300;
		}
		if(s12==-1)
		{
			y12=(-c12*(x12-300)+pow((double)c12*c12*(x12-300)*(x12-300)-b12*(a12*(x12-300)*(x12-300)-1),0.5))/b12+300;
		}
		if(x12>300+sqrt((double)b12/(b12*a12-c12*c12)) || x12<300-sqrt((double)b12/(b12*a12-c12*c12)))
		{
			vx12=-vx12;
			s12=-s12;
		}

		
		B13=B13+w13;
		if(B13==0)
		{
			w13=-w13;
		}
		if(B13==200)
		{
			w13=-w13;
		}
		a13=cos(o13)*cos(o13)/(A13*A13)+sin(o13)*sin(o13)/(B13*B13),b13=sin(o13)*sin(o13)/(A13*A13)+cos(o13)*cos(o13)/(B13*B13),c13=cos(o13)*sin(o13)/(A13*A13)-cos(o13)*sin(o13)/(B13*B13);
		x13=x13+vx13;    //自Á?变À?量¢?动¡¥态¬?化¡¥
		fillcircle(x13,y13,5);    //描¨¨绘?图ª?形?
		if(s13==1)
		{
			y13=(-c13*(x13-300)-pow((double)c13*c13*(x13-300)*(x13-300)-b13*(a13*(x13-300)*(x13-300)-1),0.5))/b13+300;
		}
		if(s13==-1)
		{
			y13=(-c13*(x13-300)+pow((double)c13*c13*(x13-300)*(x13-300)-b13*(a13*(x13-300)*(x13-300)-1),0.5))/b13+300;
		}
		if(x13>300+sqrt((double)b13/(b13*a13-c13*c13)) || x13<300-sqrt((double)b13/(b13*a13-c13*c13)))
		{
			vx13=-vx13;
			s13=-s13;
		}


		B14=B14+w14;
		if(B14==0)
		{
			w14=-w14;
		}
		if(B14==200)
		{
			w14=-w14;
		}
		a14=cos(o14)*cos(o14)/(A14*A14)+sin(o14)*sin(o14)/(B14*B14),b14=sin(o14)*sin(o14)/(A14*A14)+cos(o14)*cos(o14)/(B14*B14),c14=cos(o14)*sin(o14)/(A14*A14)-cos(o14)*sin(o14)/(B14*B14);
		x14=x14+vx14;    //自Á?变À?量¢?动¡¥态¬?化¡¥
		fillcircle(x14,y14,5);    //描¨¨绘?图ª?形?
		if(s14==1)
		{
			y14=(-c14*(x14-300)-pow((double)c14*c14*(x14-300)*(x14-300)-b14*(a14*(x14-300)*(x14-300)-1),0.5))/b14+300;
		}
		if(s14==-1)
		{
			y14=(-c14*(x14-300)+pow((double)c14*c14*(x14-300)*(x14-300)-b14*(a14*(x14-300)*(x14-300)-1),0.5))/b14+300;
		}
		if(x14>300+sqrt((double)b14/(b14*a14-c14*c14)) || x14<300-sqrt((double)b14/(b14*a14-c14*c14)))
		{
			vx14=-vx14;
			s14=-s14;
		}

		B15=B15+w15;
		if(B15==0)
		{
			w15=-w15;
		}
		if(B15==200)
		{
			w15=-w15;
		}
		a15=cos(o15)*cos(o15)/(A15*A15)+sin(o15)*sin(o15)/(B15*B15),b15=sin(o15)*sin(o15)/(A15*A15)+cos(o15)*cos(o15)/(B15*B15),c15=cos(o15)*sin(o15)/(A15*A15)-cos(o15)*sin(o15)/(B15*B15);
		x15=x15+vx15;    //自Á?变À?量¢?动¡¥态¬?化¡¥
		fillcircle(x15,y15,5);    //描¨¨绘?图ª?形?
		if(s15==1)
		{
			y15=(-c15*(x15-300)-pow((double)c15*c15*(x15-300)*(x15-300)-b15*(a15*(x15-300)*(x15-300)-1),0.5))/b15+300;
		}
		if(s15==-1)
		{
			y15=(-c15*(x15-300)+pow((double)c15*c15*(x15-300)*(x15-300)-b15*(a15*(x15-300)*(x15-300)-1),0.5))/b15+300;
		}
		if(x15>300+sqrt((double)b15/(b15*a15-c15*c15)) || x15<300-sqrt((double)b15/(b15*a15-c15*c15)))
		{
			vx15=-vx15;
			s15=-s15;
		}


		B16=B16+w16;
		if(B16==0)
		{
			w16=-w16;
		}
		if(B16==200)
		{
			w16=-w16;
		}
		a16=cos(o16)*cos(o16)/(A16*A16)+sin(o16)*sin(o16)/(B16*B16),b16=sin(o16)*sin(o16)/(A16*A16)+cos(o16)*cos(o16)/(B16*B16),c16=cos(o16)*sin(o16)/(A16*A16)-cos(o16)*sin(o16)/(B16*B16);
		x16=x16+vx16;    //自Á?变À?量¢?动¡¥态¬?化¡¥
		fillcircle(x16,y16,5);    //描¨¨绘?图ª?形?
		if(s16==1)
		{
			y16=(-c16*(x16-300)-pow((double)c16*c16*(x16-300)*(x16-300)-b16*(a16*(x16-300)*(x16-300)-1),0.5))/b16+300;
		}
		if(s16==-1)
		{
			y16=(-c16*(x16-300)+pow((double)c16*c16*(x16-300)*(x16-300)-b16*(a16*(x16-300)*(x16-300)-1),0.5))/b16+300;
		}
		if(x16>300+sqrt((double)b16/(b16*a16-c16*c16)) || x16<300-sqrt((double)b16/(b16*a16-c16*c16)))
		{
			vx16=-vx16;
			s16=-s16;
		}

		B17=B17+w17;
		if(B17==0)
		{
			w17=-w17;
		}
		if(B17==200)
		{
			w17=-w17;
		}
		a17=cos(o17)*cos(o17)/(A17*A17)+sin(o17)*sin(o17)/(B17*B17),b17=sin(o17)*sin(o17)/(A17*A17)+cos(o17)*cos(o17)/(B17*B17),c17=cos(o17)*sin(o17)/(A17*A17)-cos(o17)*sin(o17)/(B17*B17);
		x17=x17+vx17;    //自Á?Á§¡é?变À?À§¡è?量¢?¢¨¦?动¡¥¡¥ê¡è态¬?¬?化¡¥¡¥ê¡è
		fillcircle(x17,y17,5);    //描¨¨¨¡ì¨¡ì绘??图ª?ª?形??
		if(s17==1)
		{
			y17=(-c17*(x17-300)-pow((double)c17*c17*(x17-300)*(x17-300)-b17*(a17*(x17-300)*(x17-300)-1),0.5))/b17+300;
		}
		if(s17==-1)
		{
			y17=(-c17*(x17-300)+pow((double)c17*c17*(x17-300)*(x17-300)-b17*(a17*(x17-300)*(x17-300)-1),0.5))/b17+300;
		}
		if(x17>300+sqrt((double)b17/(b17*a17-c17*c17)) || x17<300-sqrt((double)b17/(b17*a17-c17*c17)))
		{
			vx17=-vx17;
			s17=-s17;
		}

		B18=B18+w18;
		if(B18==0)
		{
			w18=-w18;
		}
		if(B18==200)
		{
			w18=-w18;
		}
		a18=cos(o18)*cos(o18)/(A18*A18)+sin(o18)*sin(o18)/(B18*B18),b18=sin(o18)*sin(o18)/(A18*A18)+cos(o18)*cos(o18)/(B18*B18),c18=cos(o18)*sin(o18)/(A18*A18)-cos(o18)*sin(o18)/(B18*B18);
		x18=x18+vx18;    //自Á?Á§¡é?变À?À§¡è?量¢?¢¨¦?动¡¥¡¥ê¡è态¬?¬?化¡¥¡¥ê¡è
		fillcircle(x18,y18,5);    //描¨¨¨¡ì¨¡ì绘??图ª?ª?形??
		if(s18==1)
		{
			y18=(-c18*(x18-300)-pow((double)c18*c18*(x18-300)*(x18-300)-b18*(a18*(x18-300)*(x18-300)-1),0.5))/b18+300;
		}
		if(s18==-1)
		{
			y18=(-c18*(x18-300)+pow((double)c18*c18*(x18-300)*(x18-300)-b18*(a18*(x18-300)*(x18-300)-1),0.5))/b18+300;
		}
		if(x18>300+sqrt((double)b18/(b18*a18-c18*c18)) || x18<300-sqrt((double)b18/(b18*a18-c18*c18)))
		{
			vx18=-vx18;
			s18=-s18;
		}
		
		B19=B19+w19;
		if(B19==0)
		{
			w19=-w19;
		}
		if(B19==200)
		{
			w19=-w19;
		}
		a19=cos(o19)*cos(o19)/(A19*A19)+sin(o19)*sin(o19)/(B19*B19),b19=sin(o19)*sin(o19)/(A19*A19)+cos(o19)*cos(o19)/(B19*B19),c19=cos(o19)*sin(o19)/(A19*A19)-cos(o19)*sin(o19)/(B19*B19);
		x19=x19+vx19;    //自Á?Á§¡é?变À?À§¡è?量¢?¢¨¦?动¡¥¡¥ê¡è态¬?¬?化¡¥¡¥ê¡è
		fillcircle(x19,y19,5);    //描¨¨¨¡ì¨¡ì绘??图ª?ª?形??
		if(s19==1)
		{
			y19=(-c19*(x19-300)-pow((double)c19*c19*(x19-300)*(x19-300)-b19*(a19*(x19-300)*(x19-300)-1),0.5))/b19+300;
		}
		if(s19==-1)
		{
			y19=(-c19*(x19-300)+pow((double)c19*c19*(x19-300)*(x19-300)-b19*(a19*(x19-300)*(x19-300)-1),0.5))/b19+300;
		}
		if(x19>300+sqrt((double)b19/(b19*a19-c19*c19)) || x19<300-sqrt((double)b19/(b19*a19-c19*c19)))
		{
			vx19=-vx19;
			s19=-s19;
		}

		B20=B20+w20;
		if(B20==0)
		{
			w20=-w20;
		}
		if(B20==200)
		{
			w20=-w20;
		}
		a20=cos(o20)*cos(o20)/(A20*A20)+sin(o20)*sin(o20)/(B20*B20),b20=sin(o20)*sin(o20)/(A20*A20)+cos(o20)*cos(o20)/(B20*B20),c20=cos(o20)*sin(o20)/(A20*A20)-cos(o20)*sin(o20)/(B20*B20);
		x20=x20+vx20;    //自Á?Á§¡é?变À?À§¡è?量¢?¢¨¦?动¡¥¡¥ê¡è态¬?¬?化¡¥¡¥ê¡è
		fillcircle(x20,y20,5);    //描¨¨¨¡ì¨¡ì绘??图ª?ª?形??
		if(s20==1)
		{
			y20=(-c20*(x20-300)-pow((double)c20*c20*(x20-300)*(x20-300)-b20*(a20*(x20-300)*(x20-300)-1),0.5))/b20+300;
		}
		if(s20==-1)
		{
			y20=(-c20*(x20-300)+pow((double)c20*c20*(x20-300)*(x20-300)-b20*(a20*(x20-300)*(x20-300)-1),0.5))/b20+300;
		}
		if(x20>300+sqrt((double)b20/(b20*a20-c20*c20)) || x20<300-sqrt((double)b20/(b20*a20-c20*c20)))
		{
			vx20=-vx20;
			s20=-s20;
		}
		setfillcolor(BLUE);
		FlushBatchDraw();    //批量绘制（防卡顿）（可忽略）
		Sleep(10);    //静止10ms
	}
	_getch();
	return 0;
}